<script type="text/javascript" src="<?=base_url()?>resource/js/layer/layer.js"></script>
<script type="text/javascript">
    function dataSubmit()
    {
        if($('#sku').val()=='')
        {
            alert('请输入SKU后再查询！');
            return false;
        }
        if($('#pid').val()=='')
        {
            alert('请输入PID后再查询！');
            return false;
        }
        return true;
    }
</script>
<style>
    .dataList{
        background-image: url("http://oms.tomrepair.es/resource/images/m17_u3.png");
        width: 150px;
        height: 30px;
        line-height:30px;
        overflow:hidden;
        text-align: center;
        float: left;
        margin-right: 15px;
        margin-bottom: 10px;
    }
</style>
<!--top结束-->
<div class="mian">
    <div class="mian1">
        <div class="mian2">
            <!--left start-->
            <?php $this->load->view('defaults/common/left');?>
            <!--left end-->

            <!--right start-->
            <div class="right">
                <!--breadcrumb start-->
                <div class="righta"><?=$this->breadcrumb->generateHTML();?> </div>
                <!--breadcrumb end-->

                <!-- contents start -->
                <div id="contents">
                    <div id="ct_search">
                        <form action="<?= blang_url('wms/AuxFunction/priority_list') ?>" method="post" onsubmit="return dataSubmit()">
                            <table id="search_tb">
                                <tr>
                                    <td>
                                        SKU： <input type="text" name="sku" id='sku' size="20"  value="<?=isset($sku)?$sku:'';?>">
                                        &nbsp;&nbsp;&nbsp;
                                        PID： <input type="text" name="pid" size="20"  id='pid' value="<?=isset($pid)?$pid:'';?>">
                                        &nbsp;&nbsp;&nbsp;
                                        <input type="submit" name='submits' value=" <?= lang('wms_ss') ?> ">
                                    </td>
                                </tr>
                            </table>
                        </form>
                    </div>
                    <?php if(isset($datalist) and !empty($datalist)):?>
                    <div class="ct_content">
                        <table class="tbwd800">
                            <tr>
                                <th width='15%'>SKU</th>
                                <th width='15%'>仓库名称</th>
                                <th width='15%'>已用库存</th>
                                <th width='15%'>剩余库存</th>
                            </tr>
                            <tr>
                                <td><?=$datalist['sku']?></td>
                                <td><?=$datalist['whs_code']?></td>
                                <td><?=$datalist['on_order']?></td>
                                <td><?=$datalist['available']?></td>
                            </tr>
                            <tr></tr>
                        </table>
                        <table class="tbwd800">
                            <tr>
                                <th width='8%'>优先次序</th>
                                <th width='10%'>PID</th>
                                <th width='10%'>需要库存</th>
                                <th width='20%'>同意报价时间</th>
                                <th width='10%'>优先级</th>
                                <th width='15%'><?=lang('public_cz')?></th>
                            </tr>
                            <?php foreach ($whsSkulist as $key => $value) :?>
                                <?php if($value['pid']==$datalist['pid'] and $value['priority']=='1'):?>
                                    <tr style="color: red">
                                        <td align="center"><?=$key+1?></td>
                                        <td align="center"><?=$value['pid']?></td>
                                        <td align="center"><?=$value['qty']?></td>
                                        <td align="center"><?=date('Y-m-d H:i:s',$value['add_time'])?></td>
                                        <td align="center"><?=$value['priority_name']?></td>
                                        <td align='center'>已优先</td>
                                    </tr>
                                <?php else:?>
                                    <tr <?=($value['pid']==$datalist['pid'])?'style="color:blue"':'' ?>>
                                        <td align="center"><?=$key+1?></td>
                                        <td align="center"><?=$value['pid']?></td>
                                        <td align="center"><?=$value['qty']?></td>
                                        <td align="center"><?=date('Y-m-d H:i:s',$value['add_time'])?></td>
                                        <td align="center"><?=$value['priority_name']?></td>
                                        <td align='center'>
                                            <?php $href=blang_url('wms/AuxFunction/onePriority/'.$value['id'].'/'.$sku.'/'.$pid);?>
                                            <?=($value['pid']==$datalist['pid'] and $value['priority']=='2')?'<button><a href="'.$href.'">一键优先</a></button>':'';?>
                                        </td>
                                    </tr>
                                <?php endif?>
                            <?php endforeach?>
                        </table>
                    </div>
                    <?php endif?>
                </div>
                <!-- contents end -->
            </div>
            <!--right end-->
            <div class="clear"></div>
        </div>
    </div>
</div>